local skel = fk.CreateSkill {
  name = "role_exmode_mingcha",
}

Fk:loadTranslationTable{
  ["role_exmode_mingcha"] = "明察",
  [":role_exmode_mingcha"] = "游戏开始时，你可以查看一名其他角色是否为反贼（其他玩家可见）",
  ["#role_exmode_mingcha"] = "明察：你可以查看一名其他角色是否为反贼（其他玩家可见）",
  ["#ShowRole"] = "%from 的身份%arg %arg2",
  ["noyes"] = "不是",
}

skel:addEffect(fk.GameStart, {
  priority = 0.001,
  can_trigger = function(self, event, target, player, data)
    return target == player and player.rest == 0 and player.role == "lord"
  end,
  on_cost = function (self, event, target, player, data)
    local room = player.room
    local tos = room:askToChoosePlayers(player,{
      targets = room:getOtherPlayers(player),
      min_num = 1,
      max_num = 1,
      skill_name = skel.name,
      cancelable = true,
      prompt = "#role_exmode_mingcha",
    })
    if #tos > 0 then
      event:setCostData(self,{tos = tos})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to = event:getCostData(self).tos[1]
    local rebel = "yes"
    if to.role == "rebel" then
      room:setPlayerProperty(to, "role_shown", true)
    else
      rebel = "noyes"
    end
    room:sendLog{
      type = "#ShowRole",
      from = to.id,
      arg = rebel,
      arg2 = "rebel",
      toast = true,
    }
  end,
})

return skel
